<html>

<head>
<title>The Twisted Zope Interfaces FAQ</title>
</head>

<body>

<h1>The Twisted Zope Interfaces FAQ</h1>

<h2>Twisted components system in 2.0</h2>

<p>Twisted code's own use of the <code
class="API">twisted.python.components</code> package has been updated to use <a
href="http://www.zope.org/Wikis/Interfaces/FrontPage">Zope Interfaces</a> in
the 2.0 release.</p>

<p>New code developed using the 2.0 release of Twisted Core should use Zope
Interfaces directly rather than using the twisted.python.components
package.</p>

<h2>FAQ</h2>
 
<h3>Why is Twisted switching to Zope Interfaces?</h3>

<p>
The twisted.python.components package is a large amount of on-going
maintainence. Using the Zope Interface package also provides a greater level of
compatibility between Twisted interfaces and Zope interfaces.
</p>

<h3>Why is Twisted switching to Zope Interfaces rather than PyProtocols?</h3>

<p>
The Zope Interface package was chosen over PyProtocols because of its greater
conceptual similarity to twisted.python.components.
</p>

<h3>Will this affect my deployment?</h3>

<p>
No. Releases of Twisted Core will include Zope Interfaces.
</p>

<h3>How can I update my own code?</h3>

<p>
Classes written using twisted.python.components declare which interfaces they
implement in this style:
</p>

<code>
class C:
    __implements__ = IFoo,
</code>

<p>
This should be changed to:
</p>

<code>
class C:
    zope.interface.implements(IFoo)
</code>

<h3>

What about third party classes dependant on the old style of implements
declarations?

</h3>

<p>
Use <code class="API"
base="twisted.python.components">backwardsCompatImplements</code> to fix this.
</p>

<code>
twisted.python.components.backwardsCompatImplements(C)
</code>

<h3>What about using third party classes?</h3>

<p>
If you are using third party libraries that only declare __implements__, these
objects should be made compatible with <code
base="twisted.python.components">fixClassImplements</code>: </p>

<code>
# import o where o is some third party library
from thirdparty.lib import o

twisted.python.components.fixClassImplements(o.__class__)
</code>

<p>
This will make sure that __implements__ declarations get converted to the new
style of implements declarations.
</p>

<h2>Acknowledgements</h2>

<p>This document is the work of Jason A. Mobarak, with contributions from Mary
Gardiner.</p>

<!-- 
<h3>Will my code break?</h3>

<p>

No. Please see insert slyphon's z.i tutorial 

</p>


Stuff below may be redundant if slyphon has finished his tutorial.
Otherwise it might be a good idea for me to finish?

-->

<!--

However, there are some differences between t.p.c and Zope interfaces.
Classes originally written in this manner:

<code>

class C:
    __implements__ = IFoo,

</code>

Should be changed to:

<code>

class C:
    zope.interface.implements(IFoo)

</code>

<h3>

What about third party classes dependant on the old style of implements
declarations?

</h3>

From twisted.python.components, backwardsCompatImplements will fix this, for
example:

<code>

twisted.python.components.backwardsCompatImplements(C)

</code>

</p>

<h3>What about using third party classes?</h3>

<p>

If you are using third party libraries that only declare __implements__, these
objects should be made compatible with fixClassImplements from
twisted.python.components, for example: 

<code>

twisted.python.componets.fixClassImplements(o.__class__)

</code>

This will make sure that __implements__ declarations get converted to the new
style of implements declarations.

</p>

<h3>Where can I get Zope Interfaces</h3>

<p>

Individually packaged release can be found from the <a
href="http://zope.org/Products/ZopeInterface/">Zope Interface</a> project
website. Releases of <a href="splitfaq">Twiste-core</a> will also include the
Zope Interface package.

</p>
-->
</body>
</html>

<!--
vim: ft=html:
-->
